#ifndef __VSTATICMESHRENDER_H__
#define __VSTATICMESHRENDER_H__
#include "VRender.h"
#include "VStaticMesh.h"

class VCoreApi VStaticRenderMesh : public VRenderMesh
{
public:
	inline VStaticRenderMesh():VRenderMesh(VRMT_STATIC_MESH,0){}
	VStaticRenderMesh(VStaticMesh* Mesh):VRenderMesh(VRMT_STATIC_MESH,0),m_SrcMeshData(Mesh)
	{
	}
	inline VStaticMesh* GetMesh() { return m_SrcMeshData; }
	inline const VBoundBox& GetBoundBox() const 
	{
		VASSERT(m_SrcMeshData);
		return m_SrcMeshData->GetSurface(0).BoundBox;
	}

	inline UINT GetNumVertics() const { return m_SrcMeshData->GetSurface(0).NumVertics; }
	inline UINT GetNumIndics() const { return m_SrcMeshData->GetSurface(0).NumIndics; }

	struct CommonVertex
	{
		VVector3 Position;
		VVector2 TexCoord;		// half ????
		VByteVector Normal;
	};
	struct TangentVertex
	{
		VByteVector Tangent;
		VByteVector BiNormal;
	};
	VRVertexBufferPtr m_CommonVertexBuffer;
	VRVertexBufferPtr m_TangentVertexBuffer;
	VRIndexBufferPtr m_IndexBuffer;

protected:
	virtual void RT_Init();
	virtual void RT_Shutdown();
	virtual UINT RT_GetResource() const { return (UINT)m_SrcMeshData; }
	virtual void RT_InitVertexDeclaration();

	virtual void RT_SetDepthStreams(void* MaterialBindInfo);
	virtual void RT_SetStreams(void* MaterialBindInfo);

	VStaticMesh* m_SrcMeshData;
	
};

typedef VSmartPtr<VStaticRenderMesh> VStaticRenderMeshPtr;

#endif 
